<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">

    <link rel="stylesheet" href="/gupiao/css/weui.css">
    <link rel="stylesheet" href="/gupiao/css/jquery-weui.css">
    <link rel="stylesheet" href="/gupiao/css/style.css">
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_689900_tgundrn0e1a46lxr.css">

    <style>
        .weui-grid__icon .iconfont{font-size: 28px;color:#999;}

        .release-cont .weui-cells{margin-top: 0;}
        .bBeforeBox{padding:0;}
        .bBeforeBox label{width: 50%;}
        .bBeforeBox .bBefore:before{border:0;}
        .qrfb-btn{margin:20px 5px;}
    </style>
</head>
<body class="back1">


<div class="index-top-fix">
    <a onclick="window.history.go(-1)" class="iconfont icon-left- left"></a>
    <p class="title">编辑股票</p>
</div>

<div class="mt50"></div>
<form action="" method="post" id="edit">
    <div class="index-box release-cont">
        <input type="hidden" id="id" name="id" value="{$id}">
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <p class="xingchengz">
                        <span class="f15 open-popup">股票名称</span>
                        <input type="text" class="font1" name="name" placeholder="请输入股票名称" id="gpName">
                    </p>
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <p class="xingchengz">
                        <span class="f15 open-popup">股票缩写</span>
                        <input type="text" class="font1" name="short_name" placeholder="请输入股票缩写" id="gpshort_name">
                    </p>
                </div>
            </div>

            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <p class="xingchengz">
                        <span class="f15 open-popup">股票代码</span>
                        <input type="text" class="font1" name="code" placeholder="请输入股票缩写" id="gpCode">
                    </p>
                </div>
            </div>

            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <p class="xingchengz">
                        <span class="f15 open-popup">点评价格</span>
                        <input type="text" name="price"  class="font1" placeholder="请输入点评价格" id="gpPrice"> 元
                    </p>
                </div>
            </div>
            <div class="weui-cell weui-cells_checkbox bBeforeBox">

                <label class="weui-cell weui-check__label" for="s13">
                    <div class="weui-cell__hd">
                        <input type="radio" class="weui-check" name="is_recomm" id="s13" value="1">
                        <i class="weui-icon-checked"></i>
                    </div>
                    <div class="weui-cell__bd">
                        <p class="f15">推荐</p>
                    </div>
                </label>
                <label class="weui-cell weui-check__label bBefore" for="s14" style="border:0;">
                    <div class="weui-cell__hd">
                        <input type="radio" name="is_recomm" class="weui-check" id="s14" value="0">
                        <i class="weui-icon-checked"></i>
                    </div>
                    <div class="weui-cell__bd">
                        <p class="f15">不推荐</p>
                    </div>
                </label>
            </div>
            <div class="weui-cell weui-cells_checkbox bBeforeBox" style="display:none;">

                <label class="weui-cell weui-check__label" for="s15">
                    <div class="weui-cell__hd">
                        <input type="radio" class="weui-check" name="is_show" id="s15" value="1">
                        <i class="weui-icon-checked"></i>
                    </div>
                    <div class="weui-cell__bd">
                        <p class="f15">显示</p>
                    </div>
                </label>

                <label class="weui-cell weui-check__label bBefore" for="s16" style="border:0;">
                    <div class="weui-cell__hd">
                        <input type="radio" name="is_show" class="weui-check" id="s16" value="0">
                        <i class="weui-icon-checked"></i>
                    </div>
                    <div class="weui-cell__bd">
                        <p class="f15">不显示</p>
                    </div>
                </label>
            </div>
        </div>
    </div>
</form>

<div class="release-bottom">
    <a href="javascript:;" class="weui-btn qrfb-btn" onclick="login()">确认修改</a>
</div>

</body>
</html>
<script src="/gupiao/js/jquery.min.js"></script>
<script src="/gupiao/js/jquery-weui.min.js"></script>


<script>

    // 刚进入界面  进行数据初始化加载
    $(function(){
        var zhi = document.getElementById("id").value;
        $.ajax({
            type : "GET",
            url : "{:url('gupiao.gupiao/info')}",
            data:{id:zhi},
            dataType:'json',
            success : function (res) {
                if(res.code == 200){
                    $("#gpName").val(res.data.name);
                    $("#gpCode").val(res.data.code);
                    $("#gpPrice").val(res.data.price);
                    $("#gpshort_name").val(res.data.short_name);
                    if(res.data.is_recomm == "0"){
                        $("#s14").attr('checked',true);
                    }else if(res.data.is_recomm == "1"){
                        $("#s13").attr('checked',true);
                    }
                    if(res.data.is_show == "1"){
                        $("#s15").attr('checked',true);
                    }
                    else if(res.data.is_show == "0"){
                        $("#s16").attr('checked',true);
                    }

                   // alert('成功')
                }
                else {

                    alert('请求失败');
                }
            }
        });

    });
</script>
<script>
    // 新建点评
    function login() {
        $.ajax({
            type: "POST",                       //方法类型
            dataType: "json",                   //预期服务器返回的数据类型
            url: "{:url('gupiao.gupiao/gupiaoEdit')}" ,        //url
            data: $('#edit').serialize(),
            success: function (res) {
                if (res.code == 200) {
                    alert(res.dest)
                    location.href ="{:url('index/gupiao.lists/lists')}?type=remark";
                }
                else if(res.code == 401){
                    alert(res.dest)
                }
            },
            error : function() {
                alert("异常！");
            }
        });
    }
</script>



